package com.junzhiit.nengji.shop.model.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum LoginMethod {
	
	ACCOUNT(0,"账号"),
	WECHAT(1,"微信");
	
	private Integer method;
	
	private String value;

	private LoginMethod(Integer method,String value){
		this.method = method;
		this.value = value;
	}

	public int toIntMethod() {
		return this.method;
	}
	
	public String toStringValue() {
		return this.value;
	}

	public static LoginMethod toMethod(int method) {
		if (ACCOUNT.method == method) {
			return ACCOUNT;
		} else if (WECHAT.method == method) {
			return WECHAT;
		} else {
			throw new InvalidArgumentException("Unknown type[" + method + "].");
		}
	}
}
